/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Builder;

import DAO.InformationFilter.PrdDAO;
import java.security.Timestamp;
import java.util.Calendar;
import java.util.Date;

/**
 *
 * @author tran tuan tai
 */
public class PrdBuilder
{
    //Date m_beginTest = new Date(111, 5, 1);
    int dayPeriod = 10;

    public void Build(Date beginTest)
    {
        PrdDAO.DoEmpty();

        Calendar end = Calendar.getInstance();
        Calendar begin = Calendar.getInstance();
        Calendar now = Calendar.getInstance();

        begin.setTime(beginTest);
        end.setTime(beginTest);
        end.add(Calendar.DATE, dayPeriod);

        while(end.compareTo(now) == -1)
        {
            PrdDAO.Insert(begin.getTime(), end.getTime());
            begin.add(Calendar.DATE, dayPeriod);
            end.add(Calendar.DATE, dayPeriod);
        }

         PrdDAO.Insert(begin.getTime(), now.getTime());

    }

    public static void main(String[] argvs)
    {
        PrdBuilder builder = new PrdBuilder();
        builder.Build(new Date(111, 5, 1));
    }
}
